﻿@using RazorEngine.Templating
@using codeGen.Model;
@* @inherits TemplateBase<ClassMetadata>;  *@
using Lord.Platform.Domain.Share;
using Lord.Platform.Domain.Share.DTO.BY;
using Lord.Platform.Domain.Share.Form;

namespace Test
{
    /// <summary>
    /// @Model.ClassComment Service 服务
    /// </summary>
    public class @(@Model.ClassName+"Service") : @("I" + Model.ClassName+"Service")
    {
        private readonly IDbContext _dbContext;
        private readonly IHttpParameter _httpParameter;

        public @(@Model.ClassName+"Service")(IDbContext dbContext,IHttpParameter httpParameter)
        {
            _dbContext = dbContext;
            _httpParameter = httpParameter;
        }
@{
    @:/// <summary>
    @:/// @Model.ClassComment 删除
    @:/// </summary>
    @:public async Task<RspResult<bool>> Del(List<long> ids)
    @:{
    @:    return await _dbContext.DeleteAsync(ids);
    @:}
    @:/// <summary>
    @:/// @Model.ClassComment 获取model
    @:/// </summary>
    @:public async Task<RspResult<@("View"+Model.ClassName)>> GetModel(long id)
    @:{
    @:     await _dbContext.Queryable<@Model.ClassName>().Select<@("View"+Model.ClassName)>().Where(s=>s.Id==id).FirstAsync();
    @:}
    @:/// <summary>
    @:/// @Model.ClassComment 获取分页信息
    @:/// </summary>
    @:public async Task<RspResult<DataPager<@("View"+Model.ClassName)>>> GetPage()
    @:{
    @:    await _dbContext.Queryable<@Model.ClassName>().Select<@("View"+Model.ClassName)>().ToPageAsync(_httpParameter);
    @:}
    @:/// <summary>
    @:/// @Model.ClassComment 新增/编辑
    @:/// </summary>
    @:public Task<RspResult<bool>> Edit(@("View"+Model.ClassName) model)
    @:{
    @:    throw new NotImplementedException();
    @:}
        }
    }
}
